package com.commerce.mapping;

import com.commerce.page.Page;
import org.springframework.dao.DataAccessException;

import java.util.List;

/**
 * @author wyj
 * @Title:
 * @Description:
 */
public interface BeanMapping<E> {

    /**
     * 新增
     * @param e
     * @return
     * @throws DataAccessException
     */
    int insert(E e)throws DataAccessException;

    /**
     * 修改
     * @param e
     * @return
     * @throws DataAccessException
     */
    int update(E e)throws  DataAccessException;

    /**
     * 根据ID删除
     * @param id
     * @return
     * @throws DataAccessException
     */
    int deleteById(int id)throws DataAccessException;

    /**
     * 分页查询
     * @param page
     * @return
     * @throws DataAccessException
     */
    List<E> selectPage(Page page)throws DataAccessException;

    /**
     * 根据ID查询
     * @param id
     * @return
     * @throws DataAccessException
     */
    E selectById(int id)throws DataAccessException;
}
